import { getToken } from '@/utils/auth';
export default defineNuxtRouteMiddleware(async (to) => {
  const isLogin = getToken();
  // const useBasedata = stores.useBasedata();
  // if(isLogin){
  //   await useBasedata.setPermissions();
  // }
  if (!isLogin && to.path !== '/login') {
    // useBasedata.userInfo = [];
    return navigateTo('/login');
  } else if (isLogin && to.path === '/login') {
    return navigateTo('/dashboard');
    // return abortNavigation();
  }
});
